package com.tf.integrated.controller;

import com.ccssoft.m8.common.web.BaseController;
import com.tf.integrated.entity.SettingLogEntity;
import com.tf.integrated.service.SettingLogService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;


/**
 * 日志
 * @author allen
 * @date: 2020年9月14日上午10:56:20
 */
@Api(value = "日志",description="LogController")
@RestController
public class LogController extends BaseController
{
    public static final String METHOD_GET="Get";
    public static final String METHOD_POST="Post";
    public static final String METHOD_DELETE="Delete";
    public static final String METHOD_PUT="Put";
    public static final boolean OPEN=true;
    private static SettingLogService<SettingLogEntity> logService;

    public static void add(String name,String method,int result){
        if(OPEN){
            SettingLogEntity settingLogEntity=new SettingLogEntity();
            settingLogEntity.setName(name);
            settingLogEntity.setMethod(method);
            settingLogEntity.setResult(result);
            logService.insert(settingLogEntity);
        }
    }

    @Autowired
    public void setLogService(SettingLogService<SettingLogEntity> logService){
        LogController.logService=logService;
    }
}